package com.dgh.school.mapper;

import com.dgh.oaofficesystem.bean.Meeting;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MeetingMapper {

    //查询所有会议
    @Select("select * from meeting")
    List<Meeting> selectAll() throws Exception;

    //按lid查询会议
    @Select("select * from meeting where lid = #{lid}")
    List<Meeting> selectById(int lid) throws Exception;

    //添加会议
    @Insert("insert into meeting values(default , #{roomId} , #{mName} , #{mInfo} , #{startTime} , #{endTime})")
    void insertMeeting(Meeting m) throws Exception;

    //修改会议,根据会议室编号
    @Update("update meeting set m_name = #{meetingName} , m_info = #{mInfo} , start_time = #{startTime} , end_time = #{endTime}" +
            " where room_id = #{roomId}")
    void updateMeeting(Meeting m) throws Exception;

    //删除会议,根据会议室编号删除
    @Delete("delete from meeting where room_id = #{mid}")
    void deleteMeeting(int mid) throws Exception;

}
